from fastapi import APIRouter
from ..models import ApiResponse
import platform
import os
from datetime import datetime

# 创建路由器
router = APIRouter(
    prefix="/api/system",
    tags=["system"],
)

# 健康检查端点
@router.get("/health", response_model=ApiResponse)
async def health_check():
    return ApiResponse(
        success=True,
        message="系统正常运行",
        data={
            "status": "healthy",
            "timestamp": datetime.now().isoformat(),
            "environment": os.getenv("API_ENV", "development")
        }
    )

# 系统信息端点
@router.get("/info", response_model=ApiResponse)
async def system_info():
    return ApiResponse(
        success=True,
        message="系统信息",
        data={
            "python_version": platform.python_version(),
            "system": platform.system(),
            "platform": platform.platform(),
            "api_version": "0.1.0",
            "timestamp": datetime.now().isoformat()
        }
    )